﻿<div class="main">
    <form class="form ui-validForm" method="post" data-validate-params="beforeSubmit:'BeforeSubmit'" data-source="@Model">
        <div class="form-group">
            <label class="control-label" for="name">表名</label>
            <div class="controls">
                <div class="input-group">
                    <input type="text" name="Name" id="Name" maxlength="30" data-validate="dataType:'table',nullMsg:'请填写表名!',checkUrl:'@Url.Action("CheckExists",new{id = Request.QueryString["id"],fieldName="表名",area="Admin"})'" value="category_" class="form-control ui-edit-readonly">
                    <span class="input-group-btn">
                        <a href="javascript:void(0)" class="btn btn-default  ui-dialog btn-modify" data-custom-params="title:'修改表名',url:'@Url.ActionUrl("ModifyName")?id=@Request.QueryString["id"]',width:'600px',height:'300px',target:'self'">修改表名</a>
                    </span>
                </div>
                <span class="help-block" id="_ValidateTips_Name">为避免和其它表冲突，分类表名建议用category_作为前缀</span>
            </div>
        </div>

        <div class="form-group top_menu_only">
            <label class="control-label" for="remark">标识</label>
            <div class="controls">
                <input type="text" placeholder="仅用于标识，如xx分类表" name="Remark" id="Remark" maxlength="50" data-validate="dataType:'*',nullMsg:'请填写标识！'" class="form-control">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label" for="delete_protect">删除保护</label>
            <div class="controls checkbox">
                <label class="checkbox-inline">
                    <input type="checkbox" name="DeleteProtect" id="DeleteProtect" value="1" checked />启用
                </label>
                <span class="help-block">启用后列表页不能直接删除</span>
            </div>
        </div>



        <div class="submit-footerbar">
            <label class="control-label"></label>
            <div class="controls">
                <input type="hidden" name="Id" id="Id" />
                <input type="hidden" name="Uid" id="Uid" value="@ViewBag.Uid" class="form-control">
                <button type="button" class="btn btn-sm  btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostRefreshBack'">提交</button>
                <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var id = Request("id");
    if (IsInt(id)) {
        $(".form").FormBind({dataSourceFrom:"attr"});
    }
    else {
        $(".btn-modify").attr("disabled", "disbaled").text("表名");
    }
    function BeforeSubmit()
    {
        var $name = $("#Name");
        var $name_val = $name.val();
        if ($name_val=="category_")
        {
            Msg("请填写好完整的表名！")
            $name.focus();
            return false;
        }
        return true;
    }
</script>